﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using LostHobbits.Render;
using LostHobbits.Input;
using LostHobbits.Sound;
using LostHobbits.Physics;

namespace LostHobbits.Scene
{
    public class SceneManager : GameComponent, ISceneService
    {
        GameScene scene;
        IRenderService renderer;
        IInputService input;
        ISoundService sound;
        IPhysicsService physic;

        public SceneManager(Game game)
            : base(game)
        {
            renderer = (IRenderService)game.Services.GetService(typeof(IRenderService));
            input = (IInputService)game.Services.GetService(typeof(IInputService));
            sound = (ISoundService)game.Services.GetService(typeof(ISoundService));
            physic = (IPhysicsService)game.Services.GetService(typeof(IPhysicsService));
        }

        public override void  Update(GameTime gameTime)
        {
            scene.Update(gameTime, sound, physic);
 	        base.Update(gameTime);
        }
        
        #region ISceneService Members

        public void LoadScene(GameScene scene)
        {
            this.scene = scene;

            this.scene.Load(renderer, sound);
        }      

        public void DisposeScene(GameScene scene)
        {
            throw new NotImplementedException();
        }

        public List<RenderManager.RendationInfo> RendationAssembly()
        {
            List<RenderManager.RendationInfo> toRender = new List<RenderManager.RendationInfo>();



            return toRender;
        }

        #endregion
    }
}
